# -*- coding: utf-8 -*-#
# -------------------------------------------------------------------------------
# Name:         a 
# Author:       yepeng
# Date:         2021/10/22 2:44 下午
# Description: 生产一个可测试大型文本，电脑存储有限，没有几个T,意思一下几百M就可以了吧
# -------------------------------------------------------------------------------
import datetime
import random
import uuid


def gen_larger_text(n: int, is_add: bool):
    assert n >= 1
    flag = 'a' if is_add else 'w'
    f = open("large.txt", flag)
    for index in range(n):
        uid = str(uuid.uuid4())
        symbol = random.choice(["BTC", "ETH", "ETC", "BTS", "USDC"])
        price = random.random() * 1000
        quantity = random.randint(100, 1000)
        type = "encrypt"
        dt = str(datetime.datetime.now())
        line = f'"id":"{uid}","symbol":"{symbol}","price":"{price}","quantity":"{quantity}","type":"{type}", "datetime":"{dt}"\n'
        print(line)
        f.write(line)
    f.close()


if __name__ == '__main__':
    # 生成指定行数的数据，并写入文件
    gen_larger_text(10000, False)
